# Bracket Notation Normalizer for linguistics students

## About

Do you like using spaces and new lines while parsing a sentence on scratch paper,
but find it unwieldy for pasting in chatrooms and slides?  If you do, this tool
is for you.

Example Input:
```
   [a pineapple
        [on     [a pen]
        ][under  [an apple]]
   ]
```
Example Output:
```
   [a pineapple [on [a pen]] [under [an apple]]]
```

License: [WTFPL v2](https://web.archive.org/web/20210509045146/http://www.wtfpl.net/)

## How to use
If you know what you are doing, feel free to disregard these instructions.

#### Online:
1. Go to [Bracket Notation Normalizer](https://www.onlinegdb.com/fork/HyxGHJFkO_) on OnlineGDB.com
2. Press the green Run button
3. Follow instructions in the black panel at bottom of screen (reminder: the console panel is resizable)

#### macOS/Linux:
1. Launch terminal
2. Type `irb` and press Enter
3. Copy and paste the entire code
4. Follow the instructions

#### Windows:
If you know what you are doing just go ahead and do it. Otherwise, just use the online version.

If you aren't familiar with programming but really really want to run the script *locally*, here's how:

First you need to set up a fake Linux environment inside Windows. You only need to do this once.
1. Download and run [MSYS2 installer](https://www.msys2.org/)
2. Launch MSYS2 terminal
   - Search for `msys2` in Start Menu.  Normally it should show up after step 1.
   - If you can't find it, go to the installation folder and double click `msys2.exe`
3. Type `pacman -Syu` and press Enter. Confirm upgrade by pressing Enter again.
4. Repeat the last step until there is no more upgrades.
5. Type `pacman -S ruby` and press Enter. You know the drill.

Then, whenever you want to run the script:
1. Launch MSYS2 terminal
2. Type `irb` and press Enter
3. Copy and paste the entire code
  - If you are a mouse user, right-click and select Paste
  - If you are a keyboard user, use Shift-Ins instead of Ctrl-V
4. Follow the instructions

#### pros and cons:
- Online version is sandboxed. You don't have to read my code to make sure it's safe to run.
- Online version is quite laggy. It works for copy pasting but not so well for typing.
